<template>
  <div class="artist-list">
    <div class="artist-grid">
      <router-link
        v-for="artist in artists"
        :key="artist.id"
        :to="`/artist/${artist.id}`"
        class="artist-card"
      >
        <img :src="artist.picUrl" :alt="artist.name">
        <h3>{{ artist.name }}</h3>
        <p v-if="artist.songCount">
          单曲数：{{ artist.songCount }}
        </p>
      </router-link>
    </div>
  </div>
</template>

<script setup lang="ts">
import type { ArtistInfo } from '@/types'

defineProps<{
  artists: ArtistInfo[]
}>()
</script>

<style scoped lang="scss">
.artist-list {
  .artist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
  }

  .artist-card {
    text-decoration: none;
    color: inherit;
    text-align: center;
    
    img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 50%;
      margin-bottom: 10px;
    }
    
    h3 {
      margin: 0;
      font-size: 16px;
    }
    
    p {
      margin: 5px 0 0;
      font-size: 14px;
      color: #666;
    }
  }
}
</style> 